package ltd.dujiabao.cmsservice.controller;

import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import ltd.dujiabao.cmsservice.entity.CrmBanner;
import ltd.dujiabao.cmsservice.service.CrmBannerService;
import ltd.dujiabao.commonutils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.connection.ReactiveSubscription;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author : DuJiabao
 * @Project : online-course-project
 * @Time : 2021/4/24 13:39
 * @Desc :
 */
@Api(value = "幻灯片前台管理")
@RestController
@RequestMapping("/cmsservice/front-banner")
@Slf4j
@CrossOrigin
public class BannerFrontController {
  @Autowired
  CrmBannerService crmBannerService;

  @GetMapping("/")
  public Result getAllBanner() {
    List<CrmBanner> bannerList = crmBannerService.getAllBannerList();
    log.info("获取所有Banner" + bannerList.toString());
    return Result.success().addData("data", bannerList);
  }
}
